package _22;

import java.util.Scanner;

public class HuiWen {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("输入一个序列:");
        while(in.hasNext()) {
            String s = in.next();
            if (huiwen(s)) {
                System.out.println("这是个回文序列");
            } else {
                System.out.println("这不是个回文序列");
            }
        }
    }
    static boolean huiwen(String s) {
        int i = 0;
        int j = s.length() - 1;
        while (i < s.length() && j >=0) {
            if (s.charAt(i) != s.charAt(j)) {
                return false;
            }
            i++;
            j--;
        }
        return true;
    }
}
